#!/bin/bash

source head.sh

echo '
    <h1>科目列表</h1>
    <table>
      <tr>
        <th>科目号</th>
        <th>科目名</th>
      </tr>
'
sql="select *from jx_subject;"
stuList=$($mysqllogin "$sql" | grep -v id | sed "s/\t/@/g")
for stu in ${stuList[@]}; do
  # 获取用户ID
  id=$(echo $stu | awk -F "@" '{print $1}')
  name=$(echo $stu | awk -F "@" '{print $2}')
  echo "
        <tr>
          <td>$id</td>
          <td>$name</td>
        </tr>
  "
done

echo '
    </table>
  </div>
</body>
</html>
'

